package com.tanhua.server.service;

import com.tanhua.dubbo.api.db.UserApi;
import com.tanhua.model.db.User;
import com.tanhua.model.vo.HuanXinUserVo;
import com.tanhua.server.interceptor.UserHolder;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * 环信业务逻辑处理层
 */
@Service
@Slf4j
public class HuanXinService {

    @DubboReference
    private UserApi userApi;

    /**
     * 获取环信登录账号 密码
     */
    public HuanXinUserVo getHuanXinUser() {
        log.debug("****************getHuanXinUser***********start*******************");
        User user = userApi.findById(UserHolder.getUserId());
        HuanXinUserVo vo = new HuanXinUserVo();
        vo.setUsername(user.getHxUser());
        vo.setPassword(user.getHxPassword());
        log.debug("***********getHuanXinUser*********"+vo.toString()+"***********end************");
        return vo;
    }
}
